<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>

    <%@include file="common/head.jsp" %>

</head>

<body>

<%@include file="common/sidebar-manage.jsp" %>

<!-- 主内容 -->
<div class="main-content">
    <div class="fluid-container">

        <div class="content-wrapper">

            <div class="page-section">
                <div class="row">
                    <div class="col-md-12">
                        <h4 class="widget-title">BLOG MANAGE 博文管理</h4>
                    </div>
                </div>

                <div class="row" style="margin-top: 20px">
                    <div class="col-md-6 col-md-offset-3 col-sm-12">
                        <form>
                            <div class="input-group">
                                <input type="text" class="form-control searchContentArticle" onkeydown="onKeyDownArticle(event)"
                                       placeholder="输入关键字..."/>
                                <span class="input-group-addon searchBtnArticle">
                                    <i class="fa fa-search" aria-hidden="true"></i> 搜索</span>
                            </div>
                        </form>
                    </div>
                </div>

                <div class="row projects-holder">
                    <div class="col-md-12 col-sm-12">
                        <div class="table-responsive">
                            <table class="table table-striped text-center">
                                <thead>
                                    <tr>
                                        <th class="text-center">文章标题</th>
                                        <th class="text-center">浏览量</th>
                                        <th class="text-center">创建时间</th>
                                        <th class="text-center">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${pageInfo.list}" var="article">
                                    <tr>
                                        <td>${article.articleTitle}</td>
                                        <td>${article.articleViews}</td>
                                        <td>${article.articleCreateDate}</td>
                                        <td>
                                            <button class="btn btn-sm btn-success" onclick="window.location.href='/article/getArticle?articleId=${article.articleId}'">查 看</button>
                                            <button class="btn btn-sm btn-danger" data-toggle="modal" onclick="deleteArticle('${article.articleId}')">删 除</button>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- 分页 -->
                <div class="row text-center" style="margin-top: 20px">
                    总共 ${pageInfo.total } 篇博文
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            <li><a href="/articleManage/articleList?pn=1">首页</a></li>
                            <c:if test="${pageInfo.hasPreviousPage }">
                                <li><a href="/articleManage/articleList?pn=${pageInfo.pageNum-1}"
                                       aria-label="Previous"> <span aria-hidden="true">«</span>
                                </a></li>
                            </c:if>

                            <c:forEach items="${pageInfo.navigatepageNums }" var="page_Num">
                                <c:if test="${page_Num == pageInfo.pageNum }">
                                    <li class="active"><a href="#">${page_Num }</a></li>
                                </c:if>
                                <c:if test="${page_Num != pageInfo.pageNum }">
                                    <li>
                                        <a href="/articleManage/articleList?pn=${page_Num }">${page_Num }</a>
                                    </li>
                                </c:if>

                            </c:forEach>
                            <c:if test="${pageInfo.hasNextPage }">
                                <li><a href="/articleManage/articleList?pn=${pageInfo.pageNum+1 }"
                                       aria-label="Next"> <span aria-hidden="true">»</span>
                                </a></li>
                            </c:if>
                            <li><a href="/articleManage/articleList?pn=${pageInfo.pages}">末页</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
            <hr>

            <%@include file="common/footer.jsp" %>

        </div>

    </div>
</div>

<!-- 删除博文模态 -->
<div class="modal fade" id="deleteArticleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">系统提示</h4>
            </div>
            <div class="modal-body">
                本次操作为不可逆操作，请谨慎执行！
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
                <button type="button" class="btn btn-primary" id="deleteArticleBtn">确 定</button>
            </div>
        </div>
    </div>
</div>

<%@include file="common/end.jsp" %>

</body>

</html>